#pragma once
#include "xFrameBase.h"
#include "xnamath.h"
struct ShapeVertex
{
	XMFLOAT3 Pos;
	XMFLOAT4 Color;
};

class xShape : public xFrameBase
{
public:
	xShape();
	~xShape();
	XDECLARE_MESSAGE_MAP();
public:
	static xFrameBase *CreateObject();
private:
	xEffect				*m_pEffect;
	xTechnique			*m_pTechnique;
	xInputLayout		*m_pLayout;
	XINPUT_ELEMENT_DESC	*m_pLayoutDesc;
	xBuffer				*m_pVertexBuffer;
	xBuffer				*m_pIndexBuffer;
	XMMATRIX m_World;
	XMMATRIX m_View;
	XMMATRIX m_Projection;

	FLOAT	m_fAngleX,
			m_fAngleY,
			m_fAngleZ;

	FLOAT	m_r,
			m_g,
			m_b;

	BOOL		m_bStopRenderModule;
	xButton		m_btnStop,
				m_btnColor,
				m_btnMesh;

	D3D11_PRIMITIVE_TOPOLOGY m_Topology;
protected:
	virtual BOOL OnCreate(CREATESTRUCT *pCreate);
	virtual void OnDraw();
	virtual void OnKeyDown(DWORD dwKeyCode, DWORD dwFlags);
protected:
	void OnBtnStop(xControl &sender);
	void OnBtnColor(xControl &sender);
	void OnBtnMesh(xControl &sender);
	void OnBtnFullscreen(xControl &sender);
public:
	void re();
	void ReBuffer();
	void PrepareLayout();
	BOOL Reset(UINT nSampleCount);
	void UpdateIndexBuffer();
};